Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #
About
This PR fixes a critical crash and assertion failure that occurred when using the gpu_cylindrical Lidar sensor type. The issue was traced to a synchronous RHILockBuffer call within the Render Dependency Graph (RDG) execution, which caused deadlocks and validation failures in the Vulkan RHI (specifically FVulkanStagingBuffer::Lock reading beyond allocated sizes).
Key Changes:
Asynchronous Readback: Replaced the blocking RHILockBuffer with FRHIGPUBufferReadback. This decouples the CPU read from the GPU write, preventing render thread stalls.
Ring Buffer Implementation: Implemented a ring buffer pool (size 4) for the readback buffers.
Problem: The Lidar point cloud size is dynamic and changes every frame based on DeltaTime. Using a single readback variable caused race conditions where the Lock() size on the CPU did not match the size of the pending GPU buffer from a previous frame.
Solution: The ring buffer preserves the specific buffer size associated with each enqueued copy, ensuring that when data is read back (N frames later), the size matches exactly what was allocated for that specific frame.
Render Graph Utils: Added missing include for RenderGraphUtils.h to support AddEnqueueCopyPass.
Technical Details:
Old behavior: Synchronous lock causing check(IsInRenderingThread()) or Vulkan validation errors due to size mismatches.
New behavior: LidarIntensitySceneViewExtension now cycles through a pool of readback buffers. It attempts to lock a buffer from a previous frame; if ready, it copies the data to LidarPointCloudData. This ensures safe, non-blocking data transfer.
How Has This Been Tested?
Verified that gpu_cylindrical no longer causes the Unreal Editor to hang or crash with Vulkan RHI.
Screenshots and videos (if appropriate):